import { request } from '@/apis';
import { addPrefix } from '@/utils/helper';
import { type EnvironmentCreditRateParams, type EnvironmentCreditPenaltiesParams, type EnvironmentBlackListParams } from './types';
import { SubjectType } from '@/apis/types';

const prefixUrl = '/ep-query';

const Api = {
  tagNegative: '/screen/tagNegative',
  tagYear: '/screen/tagYear',
  getHbSubject: '/v2/hbSubject/getHbSubject',
  getPenaltyType: '/screen/penaltyResult',
  getIllegalAction: '/screen/getEnvironmentPenalty',
  getPollutionCategory: '/screen/getEnvironmentPrevention',
  getPenalty: '/getPenalty',
  getBlackList: '/v2/hbSubject/getHbSubject'
};

addPrefix(Api, prefixUrl);

export * from './types';

/** 获取评价等级 */
export const getEvaluationLevel = () => request.get({ url: Api.tagNegative });

/** 获取评价年度 */
export const getEvaluationYear = (hbSubjectType: SubjectType) => request.get({ url: Api.tagYear, params: { hbSubjectType } });

/** 获取环境信用评价表格数据 */
export const getHbSubject = (params: EnvironmentCreditRateParams) => request.get({ url: Api.getHbSubject, params });

/** 获取处罚类型 */
export const getPenaltyType = () => request.get({ url: Api.getPenaltyType });

/** 获取环境违法行为 */
export const getIllegalAction = () => request.get({ url: Api.getIllegalAction });

/** 获取环境污染防治类别 */
export const getPollutionCategory = () => request.get({ url: Api.getPollutionCategory });

/** 获取环保处罚数据 */
export const getPenalty = (params: EnvironmentCreditPenaltiesParams) => request.get({ url: Api.getPenalty, params }, { isTransformResponse: false });

/** 获取环境黑名单数据 */
export const getBlackList = (params: EnvironmentBlackListParams) => request.get({ url: Api.getBlackList, params });
